<?php

require_once dirname(__FILE__).'/../lib/questionanswerGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/questionanswerGeneratorHelper.class.php';

/**
 * questionanswer actions.
 *
 * @package    elearning
 * @subpackage questionanswer
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
 */
class questionanswerActions extends autoQuestionanswerActions
{
/*
  public function executeCreate(sfWebRequest $request)
  {
    $this->form = $this->configuration->getForm();
    $this->question_answer = $this->form->getObject();

    $this->processForm($request, $this->form);

    $this->setTemplate('new');
	//$this->redirect("executeCreate");
  }
  */
  //
  public function executeNew(sfWebRequest $request)
  {
  	$answer = new QuestionAnswer();
  	if( $request->hasParameter('questid') )
  		$questionId = $request->getParameter('questid');
  	else
  		$questionId = 0;
  	$answer->setIdQuestion($questionId);
  	$this->form = new QuestionAnswerForm($answer);
    $this->question_answer = $answer;
	//$this->redirect("executeNew");
  }
	//Sau khi sua click cancel thi chuyen ve trang questionanswer list edit mode
	public function executeListCancel( sfWebRequest $request )
	{
		$questionId = $this->getRoute()->getObject()->getIdQuestion();
		//send request answer
		$this->redirect('questionanswer/index?questid=' . $questionId );
	}
	//new mode
	public function executeListCancelNew( sfWebRequest $request )
	{
		//send request answer
		//$this->redirect('questionanswer/index?questid=' . $question_answer->getIdQuestion() );
		$this->redirect('questionanswer/index?questid=' . $request->getParameter('questid') );
	}
}
